package com.jwsoft.manager.core.dao.model;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 *
 *
 * @author fangs
 * @since 2023-02-03
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("edu_address_tree")
@Schema(name = "EduAddressTree", title = "地址树节点实体类", description = "地址树节点实体类")
public class EduAddressTree extends Model<EduAddressTree> {

    private static final long serialVersionUID = 1L;

    @Schema(name = "addressId", title = "地址id")
    @TableId(value = "address_id", type = IdType.ASSIGN_ID)
    private Long addressId;

    @Schema(name = "areaCode", title = "行政区划编码")
    @TableField(value = "area_code")
    private String areaCode;

    @Schema(name = "areaName", title = "组织名称")
    @TableField(value = "area_name")
    private String areaName;

    @Schema(name = "areaType", title = "行政区划类型 ")
    @TableField(value = "area_type")
    private String areaType;

    @Schema(name = "contact", title = "联系人")
    @TableField(value = "contact")
    private String contact;

    @Schema(name = "cellphone", title = "联系人手机")
    @TableField(value = "cellphone")
    private String cellphone;

    @Schema(name = "phone", title = "联系人电话")
    @TableField(value = "phone")
    private String phone;

    @Schema(name = "rate", title = "级别")
    @TableField(value = "rate")
    private Integer rate;

    @Schema(name = "orderNo", title = "排序号")
    @TableField(value = "order_no")
    private Integer orderNo;

    @Schema(name = "primarySchool", title = "小学默认学校组织id")
    @TableField(value = "primary_school")
    private String primarySchool;

    @Schema(name = "middleSchool", title = "中学默认学校组织id")
    @TableField(value = "middle_school")
    private String middleSchool;

    @Schema(name = "parentId", title = "上级地址/区域")
    @TableField(value = "parent_id")
    private Long parentId;

    @Schema(name = "searchTerm", title = "检索项，使用#分割")
    @TableField(value = "search_term")
    private String searchTerm;

    @Schema(name = "leafNode", title = "是否叶子节点")
    @TableField(value = "is_leaf_node")
    private Integer leafNode;

    @Schema(name = "fullAddress", title = "完整地址信息")
    @TableField(value = "full_address")
    private String fullAddress;

    @Schema(name = "majorPointer", title = "映射记录指针，对应映射记录主键address_id")
    @TableField(value = "major_pointer")
    private Long majorPointer;

    @Schema(name = "eduAddressId", title = "edu_address主键")
    @TableField(value = "edu_address_id")
    private String eduAddressId;

    @Schema(name = "lastNode", title = "是否最后非叶子节点-es数据检索节点")
    @TableField(value = "is_last_node")
    private Integer lastNode;

    @Schema(name = "esStatus", title = "0:未存到es,1:已保存到es")
    @TableField(value = "es_status")
    private Integer esStatus;

    @Schema(name = "esMsg", title = "es状态描述")
    @TableField(value = "es_msg")
    private String esMsg;

    @Schema(name = "esTime", title = "保存es时间")
    @TableField(value = "es_time")
    private Date esTime;

    @Schema(name = "createName", title = "创建人")
    @TableField(value = "create_name", fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_NULL)
    private String createName;

    @Schema(name = "createTime", title = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_NULL)
    private Date createTime;

    @Schema(name = "updateName", title = "修改人")
    @TableField(value = "update_name", fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
    private String updateName;

    @Schema(name = "updateTime", title = "更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
    private Date updateTime;

    @Schema(name = "del", title = "0,未删除,1,已删除")
    @TableField(value = "del", fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_NULL)
    @TableLogic
    private String del;

    @Schema(name = "changeNode", title = "是否变更")
    @TableField(value = "is_change_node")
    private Integer changeNode;

    @Schema(name = "leafNum", title = "叶子节点数")
    @TableField(value = "leaf_num")
    private Integer leafNum;

    @Schema(name = "affirmFlag", title = "地址节点是否确认标志：0 未确认，1 确认")
    @TableField(value = "affirm_flag")
    private Integer affirmFlag;
    @Override
    public Serializable pkVal() {
        return this.addressId;
    }
}
